home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / bibtex.vms-changes < prev    next >
Text File  |  1988-06-09  |  8KB  |  278 lines

  1. BIBTeX change file for Vax/VMS
  2. Modified, 12-Feb-88 by Jerry Leichter for Version .99b
  3. Modified, 15-Apr-88 by Jerry Leichter for Version .99c
  4. Modified, 27-May-88 by Nelson Beebe.  Fixed some spelling errors and typos
  5.     that showed up when the code was woven.  Added support for specifying
  6.     the file name on the command line.
  7. @x
  8. \def\title{\BibTeX\ }
  9. @y
  10. \pageno=\contentspagenumber \advance\pageno by 1
  11. \let\maybe=\iffalse
  12. \def\title{\BibTeX changes for Vax/VMS}
  13. @z
  14.  
  15. @x
  16. @d banner=='This is BibTeX, Version 0.99c' {printed when the program starts}
  17. @y
  18. @d banner=='This is BibTeX, Vax/VMS Version 0.99c'
  19. @z
  20.  
  21. @x
  22. @d term_out == tty
  23. @d term_in == tty
  24. @y
  25. @d term_out == output
  26. @d term_in == input
  27. @z
  28.  
  29. @x
  30. @d print(#) == begin write(log_file,#); write(term_out,#); end
  31. @d print_ln(#) == begin write_ln(log_file,#); write_ln(term_out,#); end
  32. @d print_newline == print_a_newline
  33.                 {making this a procedure saves a little space}
  34. @#
  35. @d trace_pr(#) == begin write(log_file,#); end
  36. @d trace_pr_ln(#) == begin write_ln(log_file,#); end
  37. @d trace_pr_newline == begin write_ln(log_file); end
  38.  
  39. @<Procedures and functions for all file I/O, error messages, and such@>=
  40. procedure print_a_newline;
  41. begin
  42. write_ln(log_file);
  43. write_ln(term_out);
  44. end;
  45. @y
  46. @d print(#) == begin write(log_file,#); write(term_out,#); end
  47. @d print_ln(#) == begin write_ln(log_file,#,chr(13),chr(10));
  48.  write_ln(term_out,#,chr(13),chr(10)); end
  49. @d print_newline == print_a_newline
  50.                                 {making this a procedure saves a little space}
  51. @#
  52. @d trace_pr(#) == begin write(log_file,#); end
  53. @d trace_pr_ln(#) == begin write_ln(log_file,#,chr(13),chr(10)); end
  54. @d trace_pr_newline == begin write_ln(log_file,chr(13),chr(10)); end
  55.  
  56. @<Procedures and functions for all file I/O, error messages, and such@>=
  57. procedure print_a_newline;
  58. begin
  59. write_ln(log_file,chr(13),chr(10));
  60. write_ln(term_out,chr(13),chr(10));
  61. end;
  62. @z
  63.  
  64. @x
  65. @d othercases == others: {default for cases not listed explicitly}
  66. @y
  67. @d othercases == otherwise {Vax/VMS default for cases not listed
  68.  explicitly}
  69. @z
  70.  
  71. @x
  72. program BibTEX;            {all files are opened dynamically}
  73. @y
  74. program BibTEX(input,output);
  75.             {all files are opened dynamically}
  76. @z
  77.  
  78. @x
  79. @<Compiler directives@>=
  80. @{@&$C-,A+,D-@}     {no range check, catch arithmetic overflow, no debug overhead}
  81. @!debug @{@&$C+,D+@}@+ gubed        {but turn everything on when debugging}
  82. @y
  83. On Vax/VMS, there are no compiler directives that can be introduced in this
  84. way, but we take this opportunity to include a few system-dependent goodies.
  85.  
  86. @d VAX_text==@= text @>
  87. @d VAX_new==@= new @>
  88. @d VAX_none==@= none @>
  89. @d VAX_word==@= word @>
  90. @d VAX_error==@= error @>
  91. @d VAX_length==@= length @>
  92. @d VAX_syi_sid==@= syi$_sid @>
  93. @d VAX_continue==@= continue @>
  94. @d VAX_external==@= external @>
  95. @d VAX_readonly==@= readonly @>
  96. @d VAX_volatile==@= volatile @>
  97. @d VAX_aligned==@= aligned @>
  98. @d VAX_unsigned==@= unsigned @>
  99. @d VAX_carriage_control==@= carriage_control @>
  100. @d VAX_io_setmode==@= io$_setmode @>
  101. @d VAX_iom_ctrlcast==@= io$m_ctrlcast @>
  102. @d VAX_immed==@= %immed @>
  103. @d VAX_stdescr==@= %stdescr @>
  104. @d VAX_ref==@= %ref @>
  105. @d VAX_qiow==@= $qiow @>
  106. @d VAX_assign==@= $assign @>
  107. @d VAX_numtim==@= $numtim @>
  108. @d VAX_getsyi==@= $getsyi @>
  109. @d VAX_lib_get_foreign==@= lib$get_foreign @>
  110. @d VAX_disposition==@= disposition @>
  111. @d VAX_delete==@= delete @>
  112. @d VAX_save==@= save @>
  113. @d VAX_varying==@= varying @>
  114. @d VAX_substr==@= substr @>
  115. @d VAX_trnlog==@= $trnlog @>
  116. @d VAX_ss_normal==@= ss$_normal @>
  117.  
  118. @<Compiler directives@>=
  119. @=[check(none)]@> {no debug overhead, but...}
  120. debug @=[check(all)]@> gubed {turn everything on when debugging}
  121. @z
  122.  
  123. @x Define the compile-time constant |max_rescan| for command-line processing
  124. @!lit_stk_size=100; {maximum number of literal functions on the stack}
  125. @y
  126. @!lit_stk_size=100; {maximum number of literal functions on the stack}
  127. @!max_cmdline=500; {maximum length of the rescan buffer}
  128. @z
  129.  
  130. @x
  131. @<Types in the outer block@>=
  132. @y
  133. @<Types in the outer block@>=
  134. @!word_type = [word]-32768..32767;    {16-bit integers}
  135. @z
  136.  
  137. @x
  138. @!alpha_file=packed file of text_char; {files that contain textual data}
  139. @y
  140. @!alpha_file=text; {files that contain textual data}
  141. @z
  142.  
  143. @x
  144. @d reset_OK(#)==erstat(#)=0
  145. @d rewrite_OK(#)==erstat(#)=0
  146.  
  147. @<Procedures and functions for file-system interacting@>=
  148. function erstat(var f:file):integer; extern;    {in the runtime library}
  149. @#@t\2@>
  150. function a_open_in(var f:alpha_file):boolean;    {open a text file for input}
  151. begin reset(f,name_of_file,'/O'); a_open_in:=reset_OK(f);
  152. end;
  153. @#
  154. function a_open_out(var f:alpha_file):boolean;    {open a text file for output}
  155. begin rewrite(f,name_of_file,'/O'); a_open_out:=rewrite_OK(f);
  156. end;
  157. @y
  158. @<Procedures and functions for file-system interacting@>=
  159. function a_open_in(var f:alpha_file):boolean;    {open a text file for input}
  160. begin
  161. open(f,name_of_file,VAX_readonly,VAX_error:=VAX_continue);
  162. if status(f)>0 then a_open_in:=false
  163. else begin
  164.  reset(f,VAX_error:=VAX_continue);
  165.  a_open_in:=status(f)<=0;
  166.  end;
  167. end;
  168. @#
  169. function a_open_out(var f:alpha_file):boolean;    {open a text file for output}
  170. begin
  171. open(f,name_of_file,VAX_new,16383,{VAX\_disposition:=VAX\_delete,}
  172.     VAX_error:=VAX_continue);
  173. if status(f)>0 then a_open_out:=false
  174. else begin
  175.  rewrite(f,VAX_error:=VAX_continue);
  176.  a_open_out:=status(f)<=0;
  177.  end;
  178. end;
  179. @z
  180.  
  181. @x
  182. pre_define('texinputs:  ',10,file_area_ilk);
  183. s_bst_area := hash_text[pre_def_loc];
  184. pre_define('texbib:     ',7,file_area_ilk);
  185. s_bib_area := hash_text[pre_def_loc];
  186. @y
  187. pre_define('tex$inputs: ',11,file_area_ilk);
  188. s_bst_area := hash_text[pre_def_loc];
  189. pre_define('tex$bib:    ',8,file_area_ilk);
  190. s_bib_area := hash_text[pre_def_loc];
  191. @z
  192.  
  193. @x
  194. check_cmnd_line := false;            {many systems will change this}
  195. @y
  196. check_cmnd_line := true;            {many systems will change this}
  197. @z
  198.  
  199. @x And finally, here's the code that handles the command line argument.
  200. @<Process a possible command line@>=
  201. begin
  202. do_nothing;        {the ``default system'' doesn't use the command line}
  203. end
  204. @y
  205. On VAX/VMS, we can make a program runnable by name by defining a foreign
  206. command symbol for it; the command line is then accessible via a call to
  207. \.{lib\$get\_foreign()}.  Since all we need is a single word off the
  208. command line, and since prompting for the input of that word is both a
  209. nuisance, and precludes use of nice utilities like \.{Make}, it seems
  210. simplest to pick up the name from the command line.
  211.  
  212. The Kellerman and Smith VMS \TeX{} implementation takes this notion a
  213. step further, and adds code to support running the program in native
  214. mode, complete with command line switches and fancy parsing; they have
  215. more ambition than I do just now.
  216.  
  217. @<Process a possible command line@>=
  218. begin
  219.   get_cmdline;
  220.   if (aux_name_length = file_name_size) then
  221.     sam_you_made_the_file_name_too_long
  222.   else if (aux_name_length = 0) then
  223.     goto aux_not_found
  224. end
  225. @
  226. @<Procedures and functions for all file I/O, error messages, and such@>=
  227. function VAX_lib_get_foreign(VAX_stdescr s :
  228.         packed array [a..b : integer] of char;
  229.     %immed p2 : integer;
  230.     var p3 : word_type) : integer;
  231.     fortran;
  232. @#
  233. procedure get_cmdline;
  234. label exit;
  235. var
  236.     cmdline : packed array [1..max_cmdline] of char;
  237.     cmdlength : word_type;
  238.     i : integer;
  239. @#
  240. begin
  241.     aux_name_length := 0;
  242.     if not odd (VAX_lib_get_foreign(cmdline,0,cmdlength)) then
  243.     begin
  244.         print_ln('Cannot get command line; use "bibtex file"');
  245.         return
  246.     end;
  247. @#
  248.     i:=1;
  249.     while (i<=cmdlength) and (cmdline[i]=' ') do incr(i); {skip spaces}@/
  250.     if i>cmdlength then return; {there was no argument}
  251. @#
  252.     while (cmdline[i]>' ') do    {copy the argument into |name_of_file|}
  253.     begin
  254.         if (aux_name_length = file_name_size) then
  255.         return;
  256.         incr(aux_name_length);
  257.         name_of_file[aux_name_length] := cmdline[i];
  258.         incr(i)
  259.     end;
  260. exit:
  261. end;
  262. @
  263. @z
  264.  
  265. @x
  266. This section should be replaced, if necessary, by changes to the program
  267. that are necessary to make \BibTeX\ work at a particular installation.
  268. It is usually best to design your change file so that all changes to
  269. previous sections preserve the section numbering; then everybody's version
  270. will be consistent with the printed program. More extensive changes,
  271. which introduce new sections, can be inserted here; then only the index
  272. itself will get a new section number.
  273. @y
  274. Here are the remaining changes to the program
  275. that are necessary to make \.{TeX} work on Vax/VMS.
  276.  
  277. @z
  278.